import BasePanel from "../BasePanel";
import PackItem from "./PackItem";

const {ccclass, property} = cc._decorator;

@ccclass
export default class PackPanel extends BasePanel {
    private itemParent:cc.Node;
    private isFirst:boolean=true;

    onLoad(){
        this.close;        
        this.itemParent = this.node.getChildByName("scrollview").getChildByName("view").getChildByName("content");

      
    }

    updateUI(){
        if(this.isFirst){
            this.isFirst = false;
            var packItems = QM.game.getPack();                
            packItems.forEach(pack=>{
                var com = this.itemParent.getChildByName("packItem").getComponent(PackItem);
                com.packItem = pack;
            })    
        }

    }
}
